package Data;

import java.io.Serializable;

public class GameStatus implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int nextPlayer;
	private int nbTurnsPlayer1;
	private int nbTurnsPlayer2;
	private int scorePlayer1;
	private int scorePlayer2;
	private String namePlayer1;
	private String namePlayer2;
	private boolean finish;
	
	
	public GameStatus(int firstPlayer, String name, String name2)
	{
		this.nextPlayer = firstPlayer;
		this.namePlayer1 = name;
		this.namePlayer2 = name2;
		finish = false;
	}
	
	public int getNextPlayer() {
		return nextPlayer;
	}
	public void setNextPlayer(int nextPlayer) {
		this.nextPlayer = nextPlayer;
	}
	public int getNbTurns(int player) {
		if(player == 0)
		{
			return nbTurnsPlayer1;
		}else{
			return nbTurnsPlayer2;
		}
	}
	
	public void incNbTurns(int player)
	{
		if(player == 0)
		{
			this.nbTurnsPlayer1++;
		}else{
			this.nbTurnsPlayer2++;
		}
	}
	
	
	public void setScore(int player, int score)
	{
		if(player == 0)
		{
			this.scorePlayer1 = score;
		}else{
			this.scorePlayer2 = score;
		}
	}
	
	public int getScore(int player)
	{
		if(player == 0)
		{
			return scorePlayer1;
		}else{
			return scorePlayer2;
		}
	}
	
	/**
	 * @return the finish
	 */
	public boolean isFinish() {
		return finish;
	}

	/**
	 * @param finish the finish to set
	 */
	public void setFinish(boolean finish) {
		this.finish = finish;
	}

	public String getName(int player)
	{
		if(player == 0)
		{
			if(this.namePlayer1 != null)
				return namePlayer1;
		}else{
			if(this.namePlayer2 != null)
				return namePlayer2;
		}
		return "";
	}

	public String toString()
	{
		return "NextPlayer:" + nextPlayer;
	}
}
